package com.lancoo.answer.util.paperUtils.fragmentUtils.ques;

import androidx.fragment.app.Fragment;

import com.lancoo.answer.model.ConstantBean;
import com.lancoo.answer.model.bean.Ques;
import com.lancoo.answer.ui.ques.NoSpliteLayoutFragment;
import com.lancoo.answer.ui.ques.SpliteLayoutFragment;
import com.lancoo.answer.view.fragment.correctmistake.AnalysisCorrectMistakesFragment;
import com.lancoo.answer.view.fragment.correctmistake.LookingCorrectMistakesFragment;
import com.lancoo.answer.view.fragment.option.OptionLookingFragment;
import com.lancoo.answer.view.fragment.webquesBody.WebQuesBodyLookingFragment;

/**
 * Created by pengmi on 2022/2/20 11:49
 * Description:大题查看作答状态状态fragment加载
 */
public class QuesLookingingFragmentUtils {

    public static Fragment loadQuesLookingFragment(Ques ques,
                                                   int typeIndex,
                                                   int quesIndex,
                                                   int defaultLoadChildIndex,int defaultLoadItemIndex,int defaultLoadIndex) {
        String genreID = ques.getGenreID();
        String typeNo = ques.getTypeNo();
        switch (typeNo) {
            case "A"://单选题
            case "V"://连词成句
                return NoSpliteLayoutFragment.loadFragment(typeIndex, quesIndex, defaultLoadIndex);
            case "S"://听力填空
                return SpliteLayoutFragment.loadFragment(typeIndex, quesIndex, defaultLoadChildIndex,defaultLoadItemIndex);
            case "m"://词汇匹配
                return OptionLookingFragment.Companion.loadFragment(typeIndex, quesIndex, defaultLoadChildIndex, defaultLoadItemIndex);
            case "U"://改错题
                if (ques.getIsDigitalPanel()) {
                    if (ConstantBean.getTaskControlBean().getTrainSence() == 1 || ConstantBean.getTaskControlBean().getTrainSence() == 2) {
                        return LookingCorrectMistakesFragment.Companion.loadFragment(typeIndex, quesIndex, defaultLoadIndex);
                    } else {
                        return AnalysisCorrectMistakesFragment.Companion.loadFragment(typeIndex, quesIndex, defaultLoadIndex);
                    }
                } else {
                    return WebQuesBodyLookingFragment.Companion.loadFragment(typeIndex, quesIndex, 0, defaultLoadIndex);
                }
        }
        switch (genreID) {
            case "21"://句子填空
            case "22"://翻译填空
            case "38"://句子英译中
            case "40"://句子中译英
            case "25"://英译中
            case "26"://中译
            case "VD"://词汇听写
            case "98"://看情景写句子
            case "99"://看图写句子
            case "107"://词汇翻译
                return NoSpliteLayoutFragment.loadFragment(typeIndex, quesIndex, defaultLoadIndex);
//                    case "42"://阅读匹配
//                        ReadMatchFragment readMatchFragment = new ReadMatchFragment();
//                        readMatchFragment.setQues(ques);
//                        return readMatchFragment;
//                    case "43"://段落排序
            case "45"://多项对应
            default:
                return SpliteLayoutFragment.loadFragment(typeIndex, quesIndex, defaultLoadChildIndex,defaultLoadItemIndex);
        }
    }
}
